```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@Primary注解详解 - 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .code-block {
            background: #2d2d2d;
            color: #f8f8f2;
            border-radius: 8px;
            position: relative;
        }
        .copy-btn {
            position: absolute;
            right: 10px;
            top: 10px;
            opacity: 0;
            transition: opacity 0.3s;
        }
        .code-block:hover .copy-btn {
            opacity: 1;
        }
        .card-hover {
            transition: transform 0.3s, box-shadow 0.3s;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            margin-bottom: 16px;
        }
        .mermaid {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">深入理解 <span class="bg-white text-purple-700 px-2 rounded-md">@Primary</span> 注解</h1>
                    <p class="text-xl md:text-2xl mb-8 opacity-90">Spring框架中处理Bean冲突的优雅解决方案</p>
                    <div class="flex space-x-4">
                        <a href="#usage" class="bg-white text-purple-700 hover:bg-purple-100 px-6 py-3 rounded-lg font-medium transition duration-300 shadow-md hover:shadow-lg">开始探索</a>
                        <a href="#example" class="border-2 border-white hover:bg-white hover:text-purple-700 px-6 py-3 rounded-lg font-medium transition duration-300">查看示例</a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white bg-opacity-20 p-8 rounded-2xl backdrop-blur-sm">
                        <div class="text-center">
                            <i class="fas fa-code-branch text-5xl mb-4"></i>
                            <h3 class="text-2xl font-bold mb-3">Bean冲突解决方案</h3>
                            <p class="opacity-90">@Primary注解是Spring框架中解决多个Bean候选冲突的推荐方式</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Definition Section -->
    <section class="py-16 px-4" id="definition">
        <div class="container mx-auto max-w-5xl">
            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="feature-icon bg-purple-100 text-purple-700">
                            <i class="fas fa-info-circle text-xl"></i>
                        </div>
                        <h2 class="text-3xl font-bold ml-4">@Primary注解定义</h2>
                    </div>
                    <p class="text-lg text-gray-700 leading-relaxed">
                        <span class="text-purple-600 font-medium">@Primary</span> 注解用于指定一个 Bean 作为默认的候选 Bean，当有多个候选 Bean 可供选择时，可以避免 Bean 注入冲突，使得依赖注入变得更加简单和清晰。通过使用 <span class="text-purple-600 font-medium">@Primary</span> 注解，可以有效地控制 Bean 的注入行为，并简化配置。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Usage Scenarios -->
    <section class="py-16 px-4 bg-gray-100" id="usage">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center">使用场景</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon bg-blue-100 text-blue-700">
                        <i class="fas fa-project-diagram text-xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">依赖注入冲突</h3>
                    <p class="text-gray-700">
                        在 Spring 的依赖注入过程中，如果有多个 Bean 实现了相同的接口或继承了相同的类，并且 Spring 需要自动注入这个接口或类的实例，就可能会遇到 Bean 冲突的问题。这时，<span class="text-blue-600 font-medium">@Primary</span> 注解可以用来指定一个 Bean 作为默认注入的 Bean。
                    </p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon bg-green-100 text-green-700">
                        <i class="fas fa-sliders-h text-xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">简化配置</h3>
                    <p class="text-gray-700">
                        在使用 <span class="text-green-600 font-medium">@Primary</span> 注解时，可以减少对 <span class="text-green-600 font-medium">@Qualifier</span> 注解的使用，使代码更简洁。尤其是在配置复杂的应用时，<span class="text-green-600 font-medium">@Primary</span> 使得默认 Bean 的选择变得更加明确。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Key Features -->
    <section class="py-16 px-4" id="features">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center">主要功能</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon bg-indigo-100 text-indigo-700">
                        <i class="fas fa-puzzle-piece text-xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">解决 Bean 冲突</h3>
                    <p class="text-gray-700 mb-4">
                        当多个 Bean 实现了相同的接口或继承了相同的父类，并且没有使用 <span class="text-indigo-600 font-medium">@Qualifier</span> 注解明确指定 Bean 时，Spring 会根据 <span class="text-indigo-600 font-medium">@Primary</span> 注解指定的 Bean 作为默认的 Bean 进行注入。
                    </p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover">
                    <div class="feature-icon bg-teal-100 text-teal-700">
                        <i class="fas fa-code text-xl"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">简化配置</h3>
                    <p class="text-gray-700 mb-4">
                        在配置复杂的应用时，使用 <span class="text-teal-600 font-medium">@Primary</span> 注解可以减少显式指定 Bean 的需要，使代码更加简洁明了。这在大型项目中尤其有用，可以减少样板代码的数量。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization -->
    <section class="py-16 px-4 bg-gray-100" id="visualization">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center">Bean注入决策流程图</h2>
            
            <div class="mermaid">
                graph TD
                    A[开始注入Bean] --> B{是否只有一个候选Bean?}
                    B -->|是| C[注入该Bean]
                    B -->|否| D{是否有@Primary注解的Bean?}
                    D -->|是| E[注入@Primary标记的Bean]
                    D -->|否| F{是否有@Qualifier指定?}
                    F -->|是| G[注入@Qualifier指定的Bean]
                    F -->|否| H[抛出NoUniqueBeanDefinitionException异常]
            </div>
        </div>
    </section>

    <!-- Example Section -->
    <section class="py-16 px-4" id="example">
        <div class="container mx-auto max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center">示例代码</h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-xl font-bold mb-4 text-purple-700">接口定义</h3>
                    <div class="code-block p-4 mb-6">
                        <button class="copy-btn text-gray-400 hover:text-white" title="复制代码">
                            <i class="far fa-copy"></i>
                        </button>
                        <pre><code class="language-java">public interface GreetingService {
    String greet();
}</code></pre>
                    </div>
                    
                    <h3 class="text-xl font-bold mb-4 text-blue-700">主要实现</h3>
                    <div class="code-block p-4">
                        <button class="copy-btn text-gray-400 hover:text-white" title="复制代码">
                            <i class="far fa-copy"></i>
                        </button>
                        <pre><code class="language-java">@Component
@Primary
public class SpanishGreetingService implements GreetingService {
    @Override
    public String greet() {
        return "Hola";
    }
}</code></pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-bold mb-4 text-green-700">备用实现</h3>
                    <div class="code-block p-4 mb-6">
                        <button class="copy-btn text-gray-400 hover:text-white" title="复制代码">
                            <i class="far fa-copy"></i>
                        </button>
                        <pre><code class="language-java">@Component
public class EnglishGreetingService implements GreetingService {
    @Override
    public String greet() {
        return "Hello";
    }
}</code></pre>
                    </div>
                    
                    <h3 class="text-xl font-bold mb-4 text-indigo-700">注入示例</h3>
                    <div class="code-block p-4">
                        <button class="copy-btn text-gray-400 hover:text-white" title="复制代码">
                            <i class="far fa-copy"></i>
                        </button>
                        <pre><code class="language-java">// 默认注入SpanishGreetingService (因为有@Primary)
@Autowired
private GreetingService greetingService;

// 明确指定使用EnglishGreetingService
@Autowired
@Qualifier("englishGreetingService")
private GreetingService englishGreetingService;</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded">
                <div class="flex">
                    <div class="flex-shrink-0 text-yellow-500">
                        <i class="fas fa-lightbulb text-xl"></i>
                    </div>
                    <div class="ml-3">
                        <h3 class="text-lg font-medium text-yellow-800">最佳实践</h3>
                        <p class="text-yellow-700">在大多数情况下，应该为最常用的实现添加@Primary注解，同时在需要特殊处理的地方使用@Qualifier进行显式指定。这样可以保持代码的简洁性，同时在需要时提供灵活性。</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-2xl font-bold">技术小馆</h3>
                    <p class="text-gray-400 mt-2">分享前沿技术知识</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i>
                        <span>访问技术小馆</span>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // 初始化Mermaid图表
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // 复制代码功能
        document.querySelectorAll('.copy-btn').forEach(button => {
            button.addEventListener('click', () => {
                const codeBlock = button.parentElement.querySelector('code');
                const range = document.createRange();
                range.selectNode(codeBlock);
                window.getSelection().removeAllRanges();
                window.getSelection().addRange(range);
                document.execCommand('copy');
                window.getSelection().removeAllRanges();
                
                // 显示复制成功提示
                const originalTitle = button.title;
                button.innerHTML = '<i class="fas fa-check"></i>';
                button.title = '已复制';
                setTimeout(() => {
                    button.innerHTML = '<i class="far fa-copy"></i>';
                    button.title = originalTitle;
                }, 2000);
            });
        });
    </script>
</body>
</html>
```